class Registrar(object):
    def __init__(self, username=None, pub_key=None, *args, **kwargs):
        self.username = username
        self.pub_key = pub_key

    def get_serializable(self):
        return self.__dict__

    def persist(self):
        return (
            Error(self.username, self.pub_key).get_serializable()
            if (self.username is None or self.pub_key is None)
            else self.get_serializable()
        )
        return self.__dict__


class Error:
    def __init__(self, username=None, pub_key=None):
        self.username = "Missing username" if username is None else username
        self.pub_key = "Missing pub_key" if pub_key is None else pub_key

    def get_serializable(self):
        return self.__dict__
